//
//  NewSectionHeaderView.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2020/3/17.
//  Copyright © 2020 tao Tao. All rights reserved.
//

import UIKit

class NewSectionHeaderView: UITableViewHeaderFooterView {
    
    @IBOutlet private weak var titleLabel: UILabel! {
        didSet {
            titleLabel.textColor = .textDark
            titleLabel.font = .medium_14
        }
    }
    
    func configure(at section: Int, title: String = "") {
        switch section {
        case 2:
            if title.isEmpty {
                titleLabel.text = "病情描述/主述（必填）"
            } else {
                titleLabel.text = "\(title)\n病情描述/主述（必填）"
            }
        case 4:
            let str = "既往史（选填）"
            let attrStr = NSMutableAttributedString(string: str)
            let attributes = [
                NSAttributedString.Key.foregroundColor: UIColor.textLight
            ]
            attrStr.setAttributes(attributes, range: NSRange(location: 0, length: str.count))
            titleLabel.attributedText = attrStr
        case 5: titleLabel.text = "病历、处方、检验、检查图片上传"
        default: break
        }
    }
}
